package com.goodvaluetrips.launcher;

import java.io.IOException;

import org.apache.tuscany.sca.Node;
import org.apache.tuscany.sca.TuscanyRuntime;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.monitor.ValidationException;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.runtime.ActivationException;

import com.goodvaluetrips.Trips;

public class TripProviderLauncher {

	/**
	 * @param args
	 * @throws ValidationException 
	 * @throws ContributionReadException 
	 * @throws ActivationException 
	 * @throws IOException 
	 */
	public static void main(String[] args) throws Exception{
		System.out.println("Starting Trips ....");
        String contributionURL = ContributionLocationHelper.getContributionLocation(Trips.class);
      
        
        TuscanyRuntime runtime= TuscanyRuntime.newInstance();
        Node node = runtime.createNode(TuscanyRuntime.DEFAUL_DOMAIN_NAME);
        
        node.installContribution(contributionURL);
        node.startComposite("introducing-trips-distributed","trips.composite");
        System.out.println("trips.composite ready for big business !!!");
        
        System.in.read();
        System.out.println("Stopping ...");
        node.stop();
        System.out.println();
	}

}
